package game.particle;

import engine.j2d.Color;
import engine.math.Vector2f;

public class Explosion extends ParticleSystem
{
	public Explosion(String path, int num, float life,Vector2f pos,
			Vector2f partSize, Color color)
	{
		// 0 - good, we will create by hand
		super(path, 0, 0, null, null, null, null);
		particles = new Particle[num];
		for (int i = 0; i < particles.length; i++)
		{
			explosion();
			particles[i]= new Particle(new Vector2f(pos.x,pos.y),partSize,
					new Vector2f(xs,ys),color,life);
		}
	}
	private void explosion()
	{
		if (particles.length != 0) {
			float x = (float) (Math.random() * 12 * pi);
			ang += 360.0f / (particles.length) + x;
			xs = (float) Math.cos((2 * pi * ang) / 360.0) / 5f;
			ys = (float) Math.sin((2 * pi * ang) / 360.0) / 5f;
			if (ang > 360) {
				ang = 0.0f;
			}
		}
	}
}
